package com.veo.service.Impl;

import com.veo.dao.BookManageDao;
import com.veo.entity.Books;
import com.veo.entity.BorrowBooks;
import com.veo.entity.User;
import com.veo.service.BookManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service("bookManageService")
@Transactional()
public class BookManageServiceImpl implements BookManageService {

    @Autowired
    private BookManageDao bookManageDao;
    @Override
    public List<BorrowBooks> getAllBorrowBooks() {
        return bookManageDao.getAllBorrowBooks();
    }

    @Override
    public boolean findIsbn(Books books) {
        return bookManageDao.findIsbn(books);
    }

    @Override
    public void addBorrowBooks(String userId, String bookId) {
         bookManageDao.addBorrowBooks(userId,bookId);
    }

    @Override
    public void deleteBorrowBooks(String userId, String bookId) {
        bookManageDao.deleteBorrowBooks(userId,bookId);
    }

    @Override
    public User findUserId(String idCard) {
        return bookManageDao.findUserId(idCard);
    }

    @Override
    public Books findBookId(String isbn) {
        return bookManageDao.findBookId(isbn);
    }

    @Override
    public boolean findBorrowBooks(String userId, String bookId) {
        return bookManageDao.findBorrowBooks(userId,bookId);
    }
}
